const express = require('express');
const router = express.Router();
const backupController = require('../controllers/backup.controller');
const { authenticate, authorize } = require('../middleware/auth');

// 所有备份路由都需要管理员权限
router.use(authenticate);
router.use(authorize('admin'));

// 备份操作路由
router.post('/database', backupController.backupDatabase);
router.post('/restore', backupController.restoreDatabase);
router.get('/files', backupController.getBackupFiles);
router.delete('/files/:fileName', backupController.deleteBackupFile);

module.exports = router;